﻿angular.module("umbraco").controller("UE.DealerStatisticsController",
    function ($scope, $routeParams, districtDealerSectionResource, navigationService) {
        var vm = this;
        var key = $routeParams.id;
        vm.count = {
            all: 0, mistake: 0, district: 0
        };

        districtDealerSectionResource.statistics(key).then(function (response) {
            vm.count = {
                all: response.DealerCount, mistake: response.DealerMistakeCount, district: response.SubDistrictCount
            };
            navigationService.syncTree({
                tree: 'dealerListAlias',
                path: response.Path,
                forceReload: true,
                activate: true
            }).then(function (syncArgs) {
                //console.log(syncArgs);
            });
        });

    }
);